﻿@{
    ViewBag.Title = "Core2.2后台管理";
}
@model AccountModel

<body class="hold-transition skin-blue sidebar-mini" style="overflow:hidden;">
    <div id="ajax-loader" style="cursor: progress; position: fixed; top: -50%; left: -50%; width: 200%; height: 200%; background: #fff; z-index: 10000; overflow: hidden;">
        <img src="~/Content/Image/ajax-loader.gif" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto;" />
    </div>
    <div class="wrapper">
        <!--头部信息-->
        <header class="main-header">
            <a href="http://www.baidu.com" target="_blank" class="logo">
                <span class="logo-mini">Core</span>
                <span class="logo-lg">Core2.2<strong>后台管理</strong></span>
            </a>
            <nav class="navbar navbar-static-top">
                <a class="sidebar-toggle">
                    <span class="sr-only">Toggle navigation</span>
                </a>
                <div class="navbar-custom-menu">
                    <ul class="nav navbar-nav">
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <img src="~/Content/Image/y.jpg" class="user-image" alt="User Image">
                                <span class="hidden-xs">@Model.UserName</span>
                            </a>
                            <ul class="dropdown-menu pull-right">
                                <li><a id="uppwd" class="menuItem" data-id="userInfo" data-toggle="modal"><i class="fa fa-user"></i>修改密码</a></li>
                                <li><a href="javascript:void();"><i class="fa fa-trash-o"></i>清空缓存</a></li>
                                <li class="divider"></li>
                                <li><a href="~/Home/UserPullOut"><i class="ace-icon fa fa-power-off"></i>安全退出</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <!--左边导航-->
        <div class="main-sidebar">
            <div class="sidebar">
                <div class="user-panel">
                    <div class="pull-left image">
                        <img src="~/Content/Image/y.jpg" class="img-circle" alt="User Image">
                    </div>
                    <div class="pull-left info">
                        <p>@Model.UserName</p>
                        <a><i class="fa fa-circle text-success"></i>在线</a>
                    </div>
                </div>
                <form action="#" method="get" class="sidebar-form">
                    <div class="input-group">
                        <input type="text" name="q" class="form-control" placeholder="Search...">
                        <span class="input-group-btn">
                            <a class="btn btn-flat"><i class="fa fa-search"></i></a>
                        </span>
                    </div>
                </form>
                <ul class="sidebar-menu" id="sidebar-menu">
                    <li class="header">导航菜单</li>
                </ul>
            </div>
        </div>
        <!--中间内容-->
        <div id="content-wrapper" class="content-wrapper">
            <div class="content-tabs">
                <button class="roll-nav roll-left tabLeft">
                    <i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs menuTabs">
                    <div class="page-tabs-content" style="margin-left: 0px;">
                        <a href="javascript:;" class="menuTab active" data-id="/Home/Default">欢迎首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right tabRight">
                    <i class="fa fa-forward" style="margin-left: 3px;"></i>
                </button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown tabClose" data-toggle="dropdown">
                        页签操作<i class="fa fa-caret-down" style="padding-left: 3px;"></i>
                    </button>
                    <ul class="dropdown-menu dropdown-menu-right">
                        <li><a class="tabReload" href="javascript:void();">刷新当前</a></li>
                        <li><a class="tabCloseCurrent" href="javascript:void();">关闭当前</a></li>
                        <li><a class="tabCloseAll" href="javascript:void();">全部关闭</a></li>
                        <li><a class="tabCloseOther" href="javascript:void();">除此之外全部关闭</a></li>
                    </ul>
                </div>
                <button class="roll-nav roll-right fullscreen"><i class="fa fa-arrows-alt"></i></button>
            </div>
            <div class="content-iframe" style="overflow: hidden;">
                <div class="mainContent" id="content-main" style="margin: 10px; margin-bottom: 0px; padding: 0;">
                    <iframe class="LRADMS_iframe" style="width: 100%;height:100%" src="/Home/Default" frameborder="1" data-id="/Home/Default"></iframe>
                </div>
            </div>
        </div>
    </div>

    <!-- 模态框（Modal） -->
    <div id="dvgUpPass" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-keyboard="true" data-backdrop="false">
        <div class="modal-dialog" style="width:330px">
            <div class="modal-content">
                <div class="modal-header" style="background-color:#10b5ea">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">修改密码</h4>
                </div>
                <div class="modal-body">
                    <form id="frmPassword" method="post">
                        <table style="border-collapse:separate; border-spacing:0px 10px;" cellpadding="10">
                            <tr>
                                <td>&nbsp;&nbsp;原密码:&nbsp;</td>
                                <td>
                                    <input type="password" minlength="8" maxlength="16" class="form-control" id="oldpwd" name="oldpwd" style="width:200px;font-size:15px" placeholder="原密码" required />
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;&nbsp;新密码:&nbsp;</td>
                                <td>
                                    <input type="password" minlength="8" maxlength="16" class="form-control" id="userpwd" name="userpwd" style="width:200px;font-size:15px" placeholder="原密码" required />
                                </td>
                            </tr>
                            <tr>
                                <td>验证密码:&nbsp;</td>
                                <td>
                                    <input type="password" minlength="8" maxlength="16" class="form-control" id="userpwd2" name="userpwd2" style="width:200px;font-size:15px" placeholder="原密码" required />
                                </td>
                            </tr>
                            <tr colspan="2">
                                <td id="td1"></td>
                            </tr>
                        </table>
                    </form>
                </div>
                <div class="modal-footer">
                    <button id="ConfirmPwd" type="button" class="btn btn-primary">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</body>


@section css{

}
@section js{

}

<script src="~/Content/CustomJs/BackHome.js"></script>
<script src="~/Content/BootStrap3/js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('#uppwd').click(function () {
            Clear();
            //$('#frmPassword').form('clear')
            $('#dvgUpPass').modal('show')
        });
        $('#dvgUpPass').on('shown.bs.modal', function (e) {
            // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
            $(this).css('display', 'block');
            var modalHeight = $(window).height() / 2 - $('#dvgUpPass .modal-dialog').height() / 2;
            $(this).find('.modal-dialog').css({
                'margin-top': modalHeight
            });
        });
        //修改密码事件
        $('#ConfirmPwd').click(function () {
            var $oldpwd = $("#oldpwd");
            var $userpwd = $("#userpwd");
            var $userpwd2 = $("#userpwd2");
            if ($oldpwd.val() == "") {
                $oldpwd.focus();
                formMessage('请输入原密码');
                return false;
            } else if ($userpwd.val() == "") {
                $userpwd.focus();
                formMessage('请输入新密码');
                return false;
            } else if ($userpwd2.val() == "") {
                $userpwd2.focus();
                formMessage('请验证新密码');
                return false;
            } else if ($userpwd.val() != $userpwd2.val()) {
                $userpwd2.focus();
                formMessage('两次输入的密码不一致');
                return false;
            } else {
                UpPwd();
            }
        });

        function UpPwd() {
            Clear();
            var oldpwd = $.trim($("#oldpwd").val());
            var userpwd = $.trim($("#userpwd").val());
            $.ajax({
                type: 'POST',
                url: '/Home/UpdatePwd',
                data: {
                    oldPwd: oldpwd,
                    userPwd: userpwd
                },
                dataType: 'JSON',
                success: function (data) {
                    if (data.type == 1) {
                        $("#dvgUpPass").modal('hide');
                        Jump();
                    } else {
                        formMessage(data.message);
                    }
                }
            });
        };
        function formMessage(msg) {
            Clear();
            $("#td1").after("<p id='perror' style='color:red;text-align:center;font-size:15px'>" + msg + "</p>");
        };
        function Jump() {
            window.location.href = "UserPullOut";
        }
        function Clear() {
            $("p").remove("#perror");
        }
    });

</script>




